<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="https://cdn.bootcdn.net/ajax/libs/jquery/3.6.0/jquery.js"></script>
</head>

<body>
    <h1>首页</h1>
    <button id="btnLogout">退出登录</button>
    <script>
        $.ajax({
            url: "http://localhost/islogin",
            method: "get",
            success: function(data) {
                console.log(data.code);
                if (data.code != "200") {
                    location.href = "http://localhost/logion.html"
                }
            }
        })
        $(function() {
            $("#btnLogout").click(function() {
                $.ajax({
                    url: "http://localhost/loginout",
                    method: "get",
                    succsee: function() {
                        location.href = "http://localhost/login.html"
                    }
                })
            })
        })
    </script>
</body>

</html>